package com.zzq.controller;


import com.zzq.domain.entity.SmilePhotographer;
import com.zzq.domain.search.PhotographerSearchParamet;
import com.zzq.result.SmileResult;
import com.zzq.service.PhotographerAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/admin/photographer")
@RestController
@Api(value = "摄影师管理",tags = {"摄影师管理"})
public class PhotographerAdminController {

    @Autowired
    PhotographerAdminService photographerAdminService;

    @PostMapping("/list")
    @ApiOperation("获取摄影师列表")
    public SmileResult  list(@RequestBody PhotographerSearchParamet smilePhotographer){
        SmileResult result = photographerAdminService.list(smilePhotographer);
        return result;
    }

    @GetMapping("/del")
    @ApiOperation("删除")
    public SmileResult  del( @RequestParam("photographerAccount") String  photographerAccount){
        SmileResult result = photographerAdminService.del(photographerAccount);
        return result;
    }

    @PostMapping("/update")
    @ApiOperation("更新")
    public SmileResult  update(@RequestBody SmilePhotographer smilePhotographer){
        SmileResult result = photographerAdminService.update(smilePhotographer);
        return result;
    }


    /**
     *
     * @param photographerAccount
     * @param audit true 通过 flase 未通过
     * @return
     */
    @GetMapping("/audit")
    @ApiOperation("审核")
    public SmileResult  audited(@RequestParam("photographerAccount")String  photographerAccount, @RequestParam("audit") Boolean audit){
        SmileResult result = photographerAdminService.setAudit(photographerAccount,audit);
        return result;
    }

}
